package com.zqx.facade.facade;

import com.zqx.facade.childsystem.CipherMachine;
import com.zqx.facade.childsystem.FileReader;
import com.zqx.facade.childsystem.FileWriter;

/**
 * description: 外观类
 * @author zqx
 * @date 2018/09/04
 */
public class EncryptFacade {

    //维持对子系统对象的引用
    private FileReader fileReader;
    private CipherMachine cipherMachine;
    private FileWriter fileWriter;

    public EncryptFacade() {
        fileReader = new FileReader();
        cipherMachine = new CipherMachine();
        fileWriter = new FileWriter();
    }

    public void fileEncrypt(String fileNameSrc,String fileNameDes)
    {
        String read = fileReader.read(fileNameSrc);
        String encrypt = cipherMachine.encrypt(read);
        fileWriter.write(encrypt,fileNameDes);
    }
}
